package org.grow.stt.controller;

import org.grow.stt.entity.Person;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.time.LocalDateTime;

/**
 * @Author: xwg
 * @CreateDate: 2024/8/27
 */
@CrossOrigin
@RestController
public class FirstController {

    @RequestMapping("/test1")
    public String test1() {
        return LocalDateTime.now().toString();
    }

    @RequestMapping("/test2")
    public String test2() {
        return LocalDateTime.now().toString() + "====";
    }
//    content-type "application/json"  @RequestBody

    @RequestMapping("/test10")
    public String t10(@RequestBody Person person) {
        System.out.println(person);
        return "dd";
    }
//    @RequestMapping("/test11")
//    public String t11(Person person) {
//        System.out.println(person);
//        return "dd";
//    }
    @RequestMapping("/test11")
    public String t11(@RequestParam("name") String name,@RequestParam("age") Integer age) {
        System.out.println(name);
        System.out.println(age);
        return "dd";
    }
//    /test12/zhangsan
//    /test12/lisi
    @RequestMapping("/test12/{id}")
    public String t11(@PathVariable("id") String name) {
        System.out.println(name);
        return "dd";
    }
}
